export default {
  functional: true,
  props: {
    options: {
      type: Array,
      default: () => []
    },

    props: {
      type: Object,
      default: () => ({ label: 'label', value: 'value' })
    },

    handleOption: {
      type: Function,
      default: () => ({})
    }
  },
  render(h, { data, props }) {
    const {
      options = [],
      props: { label = 'label', value = 'value' },
      handleOption
    } = props
    return (
      <el-select {...data}>
        {options.map((option, index, options) => (
          <el-option
            {...{ attrs: handleOption([option, index, options]) }}
            label={option[label]}
            value={option[value]}
          ></el-option>
        ))}
      </el-select>
    )
  }
}
